<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="jquery-1.8.3.min.js"></script>
</head>
<body>
<form action="book" method="post">
    图书名称：<input type="text" name="name">
    图书类别：<input type="text" name="category">
    图书作者：<input type="text" name="author">
    <input type="submit" value="查询">
</form>
<button onclick="location.href='toAdd'">添加</button>
    <form action="del" method="post" onsubmit="return dels()">
        <input type="submit" value="删除所选">
    <table border="1">
        <tr>
            <th>选择</th>
            <th>编号</th>
            <th>书名</th>
            <th>价格</th>
            <th>类目</th>
            <th>库存</th>
            <th>图片</th>
            <th>说明</th>
            <th>作者</th>
            <th>已售</th>
            <th>操作</th>
        </tr>
        <tr th:each="b:${page.records}">
            <td><input type="checkbox" name="ids" th:value="${b.id}"></td>
            <td th:text="${b.id}"></td>
            <td th:text="${b.name}"></td>
            <td th:text="${b.price}"></td>
            <td th:text="${b.category}"></td>
            <td th:text="${b.pnum}"></td>
            <td th:text="${b.imgurl}"></td>
            <td th:text="${b.description}"></td>
            <td th:text="${b.author}"></td>
            <td th:text="${b.sales}"></td>
            <td><a th:href="@{/toUp(id=${b.id})}">修改</a></td>
        </tr>
    </table>
    </form>
共<span th:text="${page.pages}"></span>页，当前第<spsn th:text="${page.current}"></spsn>页，共<span th:text="${page.total}"></span>条
    <a th:href="@{/book(pageNum=${page.current -1})}" th:if="${page.current>1}">上一页</a>
<!--    <span th:each="p,ph:${page.pages}">-->
<!--          <a th:href="@{/book(pageNum=${ph.count})}" th:text="${ph.count}"></a>-->
<!--    </span>-->
    <a th:href="@{/book(pageNum=${page.current +1})}" th:if="${page.current<page.pages}">下一页</a>
</body>
<script>
    function dels(){
        if($(":checkbox:checked").length==0){
            alert("请选择要删除的图书")
            return false;
        }
    }
</script>
</html>